<!DOCTYPE composition PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<ui:composition xmlns="http://www.w3.org/1999/xhtml"
    xmlns:s="http://jboss.com/products/seam/taglib"
    xmlns:ui="http://java.sun.com/jsf/facelets"
    xmlns:f="http://java.sun.com/jsf/core"
    xmlns:h="http://java.sun.com/jsf/html"
    xmlns:a="http://richfaces.org/a4j"
    xmlns:rich="http://richfaces.org/rich"
    template="layout/template.xhtml">

<ui:define name="body">

    <h:form id="utilizacaorecurso" styleClass="edit">

        <rich:panel>
            <f:facet name="header">#{utilizacaorecursoHome.managed ? 'Edit' : 'Add'} Utilizacaorecurso</f:facet>


            <s:decorate id="recursoidField" template="layout/edit.xhtml">
                <ui:define name="label">Recursoid</ui:define>
                <h:inputText id="recursoid"
                       required="true"
                       disabled="#{utilizacaorecursoHome.managed}"
                          value="#{utilizacaorecursoHome.instance.id.recursoid}">
                    <a:support event="onblur" reRender="recursoidField" bypassUpdates="true" ajaxSingle="true"/>
                </h:inputText>
            </s:decorate>

            <s:decorate id="tarefaidField" template="layout/edit.xhtml">
                <ui:define name="label">Tarefaid</ui:define>
                <h:inputText id="tarefaid"
                       required="true"
                       disabled="#{utilizacaorecursoHome.managed}"
                          value="#{utilizacaorecursoHome.instance.id.tarefaid}">
                    <a:support event="onblur" reRender="tarefaidField" bypassUpdates="true" ajaxSingle="true"/>
                </h:inputText>
            </s:decorate>





            <s:decorate id="custoField" template="layout/edit.xhtml">
                <ui:define name="label">Custo</ui:define>
                <h:inputText id="custo"
                          value="#{utilizacaorecursoHome.instance.custo}">
                    <a:support event="onblur" reRender="custoField" bypassUpdates="true" ajaxSingle="true"/>
                </h:inputText>
            </s:decorate>

            <div style="clear:both">
                <span class="required">*</span>
                required fields
            </div>

        </rich:panel>

        <div class="actionButtons">

            <h:commandButton id="save"
                          value="Save"
                         action="#{utilizacaorecursoHome.persist}"
                       disabled="#{!utilizacaorecursoHome.wired}"
                       rendered="#{!utilizacaorecursoHome.managed}"/>

            <h:commandButton id="update"
                          value="Save"
                         action="#{utilizacaorecursoHome.update}"
                       rendered="#{utilizacaorecursoHome.managed}"/>

            <h:commandButton id="delete"
                          value="Delete"
                         action="#{utilizacaorecursoHome.remove}"
                      immediate="true"
                       rendered="#{utilizacaorecursoHome.managed}"/>

            <s:button id="cancelEdit"
                   value="Cancel"
             propagation="end"
                    view="/Utilizacaorecurso.xhtml"
                rendered="#{utilizacaorecursoHome.managed}"/>

            <s:button id="cancelAdd"
                   value="Cancel"
             propagation="end"
                    view="/#{empty utilizacaorecursoFrom ? 'UtilizacaorecursoList' : utilizacaorecursoFrom}.xhtml"
                rendered="#{!utilizacaorecursoHome.managed}"/>

        </div>
    </h:form>

<rich:tabPanel switchType="ajax">

    <rich:tab label="Tipocusto *" labelClass="required">
    <div class="association" id="tipocustoParent">

        <h:outputText value="There is no tipocusto associated with this utilizacaorecurso."
                   rendered="#{utilizacaorecursoHome.instance.tipocusto == null}"/>

        <rich:dataTable var="_tipocusto"
                   value="#{utilizacaorecursoHome.instance.tipocusto}"
                rendered="#{utilizacaorecursoHome.instance.tipocusto != null}"
              rowClasses="rvgRowOne,rvgRowTwo"
                      id="tipocustoTable">
            <h:column>
                <f:facet name="header">Id</f:facet>
                <h:outputText value="#{_tipocusto.id}"/>
            </h:column>
            <h:column>
                <f:facet name="header">Nome</f:facet>
                <h:outputText value="#{_tipocusto.nome}"/>
            </h:column>
        </rich:dataTable>

        <div class="actionButtons">
            <s:button id="#{utilizacaorecursoHome.instance.tipocusto != null ? 'changeParent' : 'selectParent'}" value="#{utilizacaorecursoHome.instance.tipocusto != null ? 'Change' : 'Select'} tipocusto"
                       view="/TipocustoList.xhtml">
                <f:param name="from" value="UtilizacaorecursoEdit"/>
            </s:button>
        </div>

    </div>
    </rich:tab>

    <rich:tab label="Recurso *" labelClass="required">
    <div class="association" id="recursoParent">

        <h:outputText value="There is no recurso associated with this utilizacaorecurso."
                   rendered="#{utilizacaorecursoHome.instance.recurso == null}"/>

        <rich:dataTable var="_recurso"
                   value="#{utilizacaorecursoHome.instance.recurso}"
                rendered="#{utilizacaorecursoHome.instance.recurso != null}"
              rowClasses="rvgRowOne,rvgRowTwo"
                      id="recursoTable">
            <h:column>
                <f:facet name="header">Id</f:facet>
                <h:outputText value="#{_recurso.id}"/>
            </h:column>
            <h:column>
                <f:facet name="header">Tiporecurso id</f:facet>
                <h:outputText value="#{_recurso.tiporecurso.id}"/>
            </h:column>
            <h:column>
                <f:facet name="header">Nome</f:facet>
                <h:outputText value="#{_recurso.nome}"/>
            </h:column>
        </rich:dataTable>

        <div class="actionButtons">
            <s:button id="#{utilizacaorecursoHome.instance.recurso != null ? 'changeParent' : 'selectParent'}" value="#{utilizacaorecursoHome.instance.recurso != null ? 'Change' : 'Select'} recurso"
                       view="/RecursoList.xhtml">
                <f:param name="from" value="UtilizacaorecursoEdit"/>
            </s:button>
        </div>

    </div>
    </rich:tab>

    <rich:tab label="Tarefa *" labelClass="required">
    <div class="association" id="tarefaParent">

        <h:outputText value="There is no tarefa associated with this utilizacaorecurso."
                   rendered="#{utilizacaorecursoHome.instance.tarefa == null}"/>

        <rich:dataTable var="_tarefa"
                   value="#{utilizacaorecursoHome.instance.tarefa}"
                rendered="#{utilizacaorecursoHome.instance.tarefa != null}"
              rowClasses="rvgRowOne,rvgRowTwo"
                      id="tarefaTable">
            <h:column>
                <f:facet name="header">Id</f:facet>
                <h:outputText value="#{_tarefa.id}"/>
            </h:column>
            <h:column>
                <f:facet name="header">Projeto id</f:facet>
                <h:outputText value="#{_tarefa.projeto.id}"/>
            </h:column>
            <h:column>
                <f:facet name="header">Fim</f:facet>
                <h:outputText value="#{_tarefa.fim}">
                    <s:convertDateTime type="both" dateStyle="short"/>
                </h:outputText>
            </h:column>
            <h:column>
                <f:facet name="header">Inicio</f:facet>
                <h:outputText value="#{_tarefa.inicio}">
                    <s:convertDateTime type="both" dateStyle="short"/>
                </h:outputText>
            </h:column>
            <h:column>
                <f:facet name="header">Milestone</f:facet>
                <h:outputText value="#{_tarefa.milestone}"/>
            </h:column>
            <h:column>
                <f:facet name="header">Nome</f:facet>
                <h:outputText value="#{_tarefa.nome}"/>
            </h:column>
            <h:column>
                <f:facet name="header">Porcentcomp</f:facet>
                <h:outputText value="#{_tarefa.porcentcomp}"/>
            </h:column>
        </rich:dataTable>

        <div class="actionButtons">
            <s:button id="#{utilizacaorecursoHome.instance.tarefa != null ? 'changeParent' : 'selectParent'}" value="#{utilizacaorecursoHome.instance.tarefa != null ? 'Change' : 'Select'} tarefa"
                       view="/TarefaList.xhtml">
                <f:param name="from" value="UtilizacaorecursoEdit"/>
            </s:button>
        </div>

    </div>
    </rich:tab>
</rich:tabPanel>
</ui:define>

</ui:composition>
